/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

header h1 {
    color: #3a86ff;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

header p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* 主要内容区域 */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 签名板样式 */
.signature-pad-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow: hidden;
}

#signaturePad {
    width: 100%;
    height: 300px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background-color: #fff;
    cursor: crosshair;
    touch-action: none;
}

.signature-pad-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.pen-settings {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pen-color, .pen-size {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pen-color label, .pen-size label {
    font-size: 0.9rem;
    color: #6c757d;
}

#penColor {
    width: 40px;
    height: 30px;
    border: none;
    cursor: pointer;
}

#penSize {
    width: 100px;
}

/* 按钮样式 */
.action-btn, .primary-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.action-btn {
    background-color: #e9ecef;
    color: #495057;
}

.action-btn:hover {
    background-color: #dee2e6;
}

.primary-btn {
    background-color: #3a86ff;
    color: white;
}

.primary-btn:hover {
    background-color: #2667cc;
}

/* 结果容器样式 */
.result-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: none;
}

.result-container h2 {
    color: #3a86ff;
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-align: center;
}

.signature-result {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.signature-result img {
    max-width: 100%;
    border: 1px solid #e9ecef;
    border-radius: 5px;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* 历史签名样式 */
.saved-signatures {
    margin-top: 30px;
}

.saved-signatures h2 {
    color: #3a86ff;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.saved-signatures-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.saved-signature-item {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 10px;
    position: relative;
}

.saved-signature-item img {
    width: 100%;
    border-radius: 5px;
}

.saved-signature-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.saved-signature-actions button {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* 页脚样式 */
footer {
    margin-top: 50px;
    text-align: center;
    color: #6c757d;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-container.show {
    display: block;
    animation: fadeIn 0.5s ease forwards;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .signature-pad-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pen-settings {
        width: 100%;
        justify-content: space-between;
        margin: 10px 0;
    }
    
    .result-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .result-actions button {
        width: 100%;
    }
    
    .saved-signatures-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    right: 10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 提示消息 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}